/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package commonBackingBean;

import entities.News;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ResourceBundle;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.inject.Named;
import operation.student.StuNewsBean;
import operation.teacher.TeaNewsBean;
import tools.StaticFields;

/**
 *
 * @author asus
 */
@Named
@ApplicationScoped
public class NewsBean implements java.io.Serializable{
    @Inject
    private StuNewsBean stuNewsBean;
    @Inject
    private TeaNewsBean teaNewsBean;
    private LinkedHashMap<String, List<News>> newsHashMap;


 
    /**
     * @return the newsHashMap
     */
    
    public LinkedHashMap<String, List<News>> getNewsHashMap() {
        if(null==newsHashMap){
            String[] roleStrings=StaticFields.MESSAGES_PROPTES.getString("roleArray").split(",");
            newsHashMap=new LinkedHashMap<>();
            newsHashMap.put(roleStrings[0], stuNewsBean.getRecentNews());
            newsHashMap.put(roleStrings[1], teaNewsBean.getRecentNews());
        }
        return newsHashMap;
    }

    /**
     * @param newsHashMap the newsHashMap to set
     */
    public void setNewsHashMap(LinkedHashMap<String, List<News>> newsHashMap) {
        this.newsHashMap = newsHashMap;
    }

}
